package com.kfm.servlet;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;

@WebServlet("/generic")
public class MyGenericServlet extends GenericServlet {

    private AtomicInteger count;

    public MyGenericServlet(){
        System.out.println("MyGenericServlet()");
    }

    @Override
    public void init() throws ServletException {
        System.out.println("init()");
        count = new AtomicInteger(0);
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("MyGenericServlet -- 接收到请求");
        count.getAndIncrement();
    }
}
